<template>
  <div class="left-side">
    <div class="left-side-inner">
      <router-link to="/" class="logo block">
        <!--<img src="http://ophdr3ukd.bkt.clouddn.com/logo.png" alt="荣者地产房源管理平台">-->
        <h2 style="color: #ffffff">小白机器人</h2>
      </router-link>
      <el-menu
        class="menu-box"
        theme="dark"
        router
        :default-active="$route.path">
        <div
          v-for="(item, index) in nav_menu_data"
          :key="index">
          <el-menu-item
            class="menu-list"
            v-if="typeof item.child === 'undefined'"
            :index="item.path">
            <i class="icon fa" :class="item.icon"></i>
            <span v-text="item.title" class="text"></span>
          </el-menu-item>
          <el-submenu
            :index="item.path"
            v-show="item.visible"
            v-else>
            <template slot="title">
              <i class="icon fa" :class="item.icon"></i>
              <span v-text="item.title" class="text"></span>
            </template>
            <el-menu-item
              class="menu-list"
              v-for="(sub_item, sub_index) in item.child"
              v-show="sub_item.visible"
              :index="sub_item.path"
              :key="sub_index">
              <!--<i class="icon fa" :class="sub_item.icon"></i>-->
              <span v-text="sub_item.title" class="text"></span>
            </el-menu-item>
          </el-submenu>
        </div>
      </el-menu>
    </div>
  </div>
</template>
<script type="text/javascript">
  //TODO 根据权限来渲染 菜单
  import {functionCodes} from 'common/config'


  export default {
    name: 'slide',
    data() {
      return {
        nav_menu_data: []
      }
    },
    mounted() {
      this.nav_menu_data = [{
        title: "主页",
        path: "/home",
        icon: "fa-home"
      },
        {
          title: "商品管理",
          path: "/product",
          icon: "fa-cog",
          visible: true,
          child: [
            {
              title: "商品列表",
              visible: true,
              path: "/product/list"
            }
          ]
        }]
    }
  }
</script>
